<div class="user-home-user-name" th:text="${user.userName}"></div>
<div class="user-home-op-btn">

    <th:block th:if="${focusType eq '1'}">
        <a href="/admin" class="btn btn-sm btn-info">后台管理</a>&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="/admin/preAddBlog" class="btn btn-sm btn-info">写写博客</a>
    </th:block>
    <a href="javascript:;" th:attr="focustype=${focusType}" id="focus-btn" class="btn  btn-success"
       th:if="${focusType eq '0'}">关注</a>
    <a href="javascript:;" th:attr="focustype=${focusType}" id="focus-btn" class="btn  btn-warning"
       th:unless="${focusType eq '2'}">取消关注</a>
</div>
<div class="user-home-friend">
    <span id="left-fans-count"
          th:text="${#strings.defaultString(fansCount,'0')}">0</span>粉丝&nbsp;&nbsp;/&nbsp;&nbsp;<span
        id="left-focus-count" th:text="${#strings.defaultString(focusCount,'0')}"></span>关注
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">积分:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(user.mark,'0')}">0</span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">性别:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(user.sex,'未知')}">
				1
	</span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">出生日期:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(#temporals.format(user.birthday,'yyyy-MM-dd'),'未知')}"></span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">工作:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(user.work,'未知')}"></span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">地区:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(user.address,'未知')}">未知</span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">加入时间:</span>
    <span class="user-home-info" th:text="${#temporals.format(user.registerTime,'yyyy-MM-dd HH:mm:ss')}"></span>
</div>
<div class="user-home-info-item">
    <span class="user-home-info-tit">上次登录:</span>
    <span class="user-home-info" th:text="${#strings.defaultString(#temporals.format(user.lastLoginTime,'yyyy-MM-dd HH:mm:ss'),'未知')}"></span>
</div>


<script>
    $(function () {
        $("#focus-btn").click(function () {
            if (fzqblog.userId == "") {
                fzqblog.goLogin();
                return;
            }
            var focusType = $(this).attr("focusType");
            var url = "";
            var type = "";
            if (focusType == "1") {//关注
                url = fzqblog.realpath + "/friend/focus";
                type = 'POST'
            } else if (focusType == "2") {
                url = "/friend/cancel/focus";
                type = 'DELETE'
            }
            var that = $(this);

            $.ajax({
                url: url,
                type: type,
                dataType: 'json',
                data: {friendUserId: fzqblog.userId},
                success: function (res) {
                    if (focusType == "1") {
                        that.attr("focusType", 2);
                        that.html("取消关注");
                        that.removeClass('btn-success');
                        that.addClass('btn-warning');
                        $("#left-fans-count").text(parseInt($("#left-fans-count").text()) + 1);
                    } else if (focusType == "2") {
                        that.attr("focusType", 1);
                        that.removeClass('btn-warning');
                        that.addClass('btn-success');
                        that.html("&nbsp;&nbsp;关&nbsp;&nbsp;&nbsp;&nbsp;注&nbsp;&nbsp;");
                        $("#left-fans-count").text(parseInt($("#left-fans-count").text()) - 1);
                    }
                }

            });
        });
    })
</script>		
